package com.sps.loadingdemo;

import android.app.Application;
import android.content.Context;

import com.zhy.http.okhttp.OkHttpUtils;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;


/**
 * Created by LZH on 2017/3/6.
 */

public class MyApplication extends Application {

    //全局的上下文对象
    private static Context context;


    @Override
    public void onCreate() {
        super.onCreate();
        //获取Context
        context = getApplicationContext();
        OkHttpClient okHttpClient = new OkHttpClient.Builder()
                .connectTimeout(5000L, TimeUnit.MILLISECONDS)//10秒
                .readTimeout(5000L, TimeUnit.MILLISECONDS)
                //其他配置
                .build();
        OkHttpUtils.initClient(okHttpClient);

    }
}

